﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using Bitis_KeToanThue_Pro_DungChung.Common;

namespace Bitis_KeToanThue_Pro_QuanTri.AccessDatabase
{
    public class EditQuyenInGroupOnUser
    {
        AccessData ac = new AccessData(1);
        public DataTable loadluoieditquyen(int idphannhomnguoidung,int vitri,int chuongtrinh,int nhommenu)
        {
            SqlParameter[] arrPara = new SqlParameter[4];
            arrPara[0] = new SqlParameter("@IDPhanNhomNguoiDung", SqlDbType.Int);
            arrPara[0].Value = idphannhomnguoidung;
            arrPara[1] = new SqlParameter("@ViTri", SqlDbType.Int);
            arrPara[1].Value = vitri;
            arrPara[2] = new SqlParameter("@ChuongTrinh", SqlDbType.Int);
            arrPara[2].Value = chuongtrinh;
            arrPara[3] = new SqlParameter("@NhomMenu", SqlDbType.Int);
            arrPara[3].Value = nhommenu;
            return ac.ftblDocDuLieuSP("editquyen_loadluoiquyen", arrPara);
        }
        public int capnhatquyen(int id, int capnhat, int xem, int xoa)
        {
            SqlParameter[] arrPara = new SqlParameter[4];
            arrPara[0] = new SqlParameter("@ID", SqlDbType.Int);
            arrPara[0].Value = id;
            arrPara[1] = new SqlParameter("@CapNhat", SqlDbType.Int);
            arrPara[1].Value = capnhat;
            arrPara[2] = new SqlParameter("@Xem", SqlDbType.Int);
            arrPara[2].Value = xem;
            arrPara[3] = new SqlParameter("@Xoa", SqlDbType.Int);
            arrPara[3].Value = xoa;
            DataTable dt = ac.ftblDocDuLieuSP("editquyen_capnhatquyentrenmenu", arrPara);
            return int.Parse(dt.Rows[0]["ErrCode"].ToString());
        }
       
        public DataTable loadluoiuser(int manhom)
        {
            SqlParameter[] arrPara = new SqlParameter[1];
            arrPara[0] = new SqlParameter("@MaNhom", SqlDbType.Int);
            arrPara[0].Value = manhom;
            return ac.ftblDocDuLieuSP("editquyen_loadluoiuser", arrPara);
        }
        public DataTable loadluoiusergroup()
        {

            return ac.ftblDocDuLieuSP("editquyen_loadluoiusergroup", null);
        }
        public DataTable loadcombovitri()
        {

            return ac.ftblDocDuLieuSP("editquyen_loadcombovitri", null);
        }
        public DataTable loadcombochuongtrinh()
        {

            return ac.ftblDocDuLieuSP("editquyen_loadcombochuongtrinh", null);
        }
        public DataTable loadcombonhommenu()
        {

            return ac.ftblDocDuLieuSP("editquyen_loadcombonhommenu", null);
        }
    }
}
